package stu;

import org.junit.jupiter.api.Test;

import java.time.LocalDate;
import java.time.Period;
import java.time.temporal.ChronoUnit;
import java.util.*;

/**
 * @author small瑞
 */
public class TestAll {
    int count = 0;
    void dfs(int cur){
        if(cur<0) {
            return;
        }
        if(cur == 0) {
            count++;
            return;
        }
        dfs(cur-1);
        dfs(cur - 2);
    }
    public static void main(String[] args) {
        /*
        int[] data = { 19 , 22 , 98 , 100 , 56 , 77 , 45 , 72 , 0 , -1 };
        int n = data.length;
        for(int i = 0 ; i < n - 1; i++){
            for(int j = 0 ; j < n-i-1 ; j++){
                if(data[j] > data[j+1]){
                    int temp = data[j];
                    data[j] = data[j+1];
                    data[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(data));
        System.out.println(Factorial(20));
         */
        /*
        Map<String,Integer> map = new HashMap<>();
        map.put( "张三丰" , 108 );
        map.put( "殷天正" , 79 );
        map.put( "张翠山" , 36 );
        map.put( "殷素素" , 30 );
        map.put( "张无忌" , 8 );
        map.put( "周芷若" , 7 );
        for(Map.Entry cur: map.entrySet()){
            System.out.println(cur);
        }
        System.out.println("---------------------");
        Iterator iterator = map.entrySet().iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("----------------------");

         */
        /*
        List<String> list = new ArrayList<>() ;
        list.add("张三丰");
        list.add( "殷天正" );
        list.add( "张翠山" );
        list.add( "殷素素" );
        list.add( "张无忌" );
        list.add( "周芷若" );
        Iterator iterator = list.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("-----------------------");
        for(String cur:list){
            System.out.println(cur);
        }
        System.out.println("-------------------------");
        for(int i = 0 ; i < list.size() ; i++){
            System.out.println(list.get(i));
        }
        System.out.println("--------------------------");
        int[][] arr = {
                { 12, 34, 68, 32, 9, 12, 545 },
                { 34, 72, 82, 57, 56, 0, 213 },
                { 12, 34, 68, 32, 21, 945, 23 },
                { 91, 10, 3, 2354, 73, 34, 18 },
                { 12, 83, 189, 26, 27, 98, 33 },
                { 47, 23, 889, 24, 899, 23, 657 },
                { 12, 34, 68, 343, 878, 235, 768 },
                { 12, 34, 98, 56, 78, 12, 546 },
                { 26, 78, 2365, 78, 34, 256, 873 }
        };
        sortIntArrays(arr,2,true);
        for(int[]cur:arr){
            System.out.println(Arrays.toString(cur));
        }

         */
        String pre = "ssdds";
        String cur = "sddss";
        System.out.println();
        System.out.println();

    }
    static long Factorial(int cur){
        if(cur == 1) {
            return cur;
        }
        return cur*Factorial(cur-1);
    }
    static public void sortIntArrays( int[][] a , int sortCols , boolean style ) {
        Comparator<int[]> comparator;
        if(style){
            comparator = (x,y)-> x[sortCols]-y[sortCols];
            Arrays.sort(a,comparator);
        }
        if(!style) {
            comparator = (x, y) -> y[sortCols] - x[sortCols];
            Arrays.sort(a,comparator);
        }


    }

    @Test
    public void Test01(){
        Random random = new Random();

        LocalDate start = LocalDate.of(random.nextInt(5000),random.nextInt(13),random.nextInt(29));
        LocalDate after = LocalDate.of(random.nextInt(5000),random.nextInt(13),random.nextInt(29));

        Period until = start.until(after);

    }
    @Test
    public void Test02(){
        String cur1 = "779547853567944361646796413529854316337622379127456186173866698141925185953533154694734739531332878";
        String cur2 = "779547853679443616467964135298543163376223791274561861738666981419251859535331546947347395531332878";
        System.out.println(cur1.compareTo(cur2));
    }

}
